package com.oocl.json2book;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.oocl.dao.pojo.Book;

public class Json2Book {
	public Book json2Book(String s){
		Book book=new Book();
		ObjectMapper mapper = new ObjectMapper();  
		try {
			book=(Book)mapper.readValue(s, Book.class);
		} catch (JsonParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (JsonMappingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		return book;
	}

}
